<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>预约医生</title>
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.7.0/themes/metro-blue/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.7.0/themes/icon.css">
    <script type="text/javascript" src="/static/jquery-easyui-1.7.0/jquery.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.7.0/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.7.0/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        var url;

        function searchReservation() {
            $("#dg").datagrid('load', {
                "bSaleDate": $("#s_bSaleDate").val(),
                "eSaleDate": $("#s_eSaleDate").val()
            });
        }

        function formatCustomer(val, row) {
            return val.contact;
        }

        function formatPet(val, row) {
            return val.name;
        }

        function formatStatus(val, row) {
            if (val == 0) {
                return "可以预约";
            }
        }

        function formatReserveDate(val, row) {
            return val.substring(0, 4) + "年" + val.substring(5, 7) + "月" + val.substring(8, 10) + "日 " + val.substring(11, 13) + val.substring(13, 16);
        }

        function acceptReservation(status) {
            var selectedRows = $("#dg").datagrid("getSelections");
            if (selectedRows.length != 1) {
                $.messager.alert("系统提示", "请选择一个要接受的预约！");
                return;
            }
            var id = selectedRows[0].id;
            $.messager.confirm("系统提示", "您确定要接受预约吗?", function (r) {
                if (r) {
                    $.post("/admin/reservation/dealReservation", {
                        status: status,
                        reservationId: id
                    }, function (result) {
                        if (result.success) {
                            $.messager.alert("系统提示", "接受预约成功！");
                            $("#dg").datagrid("reload");
                        } else {
                            $.messager.alert("系统提示", result.errorInfo);
                        }
                    }, "json");
                }
            });
        }
    </script>
</head>
<body style="margin: 1px">
<table id="dg" title="预约单管理" class="easyui-datagrid"
       fitColumns="true" pagination="true" rownumbers="true" singleselect="true"
       url="/admin/reservation/listNotHandleDoctor" fit="true" toolbar="#tb">
    <thead>
    <th field="id" width="10" align="center">编号</th>
    <th field="reserveDate" width="12" align="center" formatter="formatReserveDate">预约时间</th>
    <th field="status" width="8" align="center" formatter="formatStatus">预约状态</th>
    </thead>
</table>

<div id="tb">
    <div>
        &nbsp;日期:
        <input id="s_bSaleDate" class="easyui-datetimebox" editable=false style="width:180px"/>
        &nbsp;-&nbsp;
        <input id="s_eSaleDate" class="easyui-datetimebox" editable=false style="width:180px"/>
        <a href="javascript:searchReservation()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
    </div>
</div>
</body>
</html>